﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Text;
using WebServer.Biz;
using WebServer.Models;

namespace WebServer
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“User”。
    // 注意: 为了启动 WCF 测试客户端以测试此服务，请在解决方案资源管理器中选择 User.svc 或 User.svc.cs，然后开始调试。
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class User : IUser
    {


        #region 心情逻辑
        /// <summary>
        /// 获取分类
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public Mood Mood(DateTime Day)
        {
            Mood request = new Mood();
            request = new UserBiz().Mood(Day);
            return request;
        }


        /// <summary>
        /// 分类动作 Filed == "IsCompany"  || Filed == "IsLive"  || Filed == "IsDel"
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Filed"></param>
        /// <param name="Fn"></param>
        /// <returns></returns>
        public bool MoodAction(DateTime Day, string Filed)
        {
            bool request = false;
            request = new UserBiz().MoodAction(Day, Filed);
            return request;
        }


        #endregion

        #region 分类逻辑
        /// <summary>
        /// 获取分类
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<UCate> Cate(bool IsDel)
        {
            List<UCate> request = new List<UCate>();
            request = new UserBiz().Cate(IsDel);
            return request;
        }

        /// <summary>
        /// 获取分类
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public UCate CateByID(int ID)
        {
            UCate request = new UCate();
            request = new UserBiz().CateByID(ID);
            return request;
        }

        /// <summary>
        /// 分类动作 Filed == "IsCompany"  || Filed == "IsLive"  || Filed == "IsDel"
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Filed"></param>
        /// <param name="Fn"></param>
        /// <returns></returns>
        public bool CateAction(int ID, string Filed, bool Fn)
        {
            bool request = false;
            request = new UserBiz().CateAction(ID, Filed, Fn);
            return request;
        }

        /// <summary>
        /// 设置分类
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public bool CateSet(UCate U)
        {
            bool request = false;
            request = new UserBiz().CateSet(U);
            return request;
        }
        #endregion

        #region 审核分析师，经济商
        /// <summary>
        /// 审核分析师，经济商
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="CateName"></param>
        /// <param name="Name"></param>
        /// <param name="Tel"></param>
        /// <param name="Email"></param>
        /// <param name="Address">可以模糊查询</param>
        /// <param name="QQInfo"></param>
        /// <param name="CheckCode"></param>
        /// <param name="Order">默认为时间排序，1-是否审核，2-地址</param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<CheckUser> CheckUserList(int PageSize, int PageIndex, string CateName, string Name, string Tel, string Email, string Address, string QQInfo, string CheckCode, int Order, bool Desc, bool IsDel)
        {
            List<CheckUser> entitys = new List<CheckUser>();
            entitys = UserBiz.CheckUserList(PageSize, PageIndex, CateName, Name, Tel, Email, Address, QQInfo, CheckCode, Order, Desc, IsDel);
            return entitys;
        }

        /// <summary>
        /// 审核分析师，经济商总数.
        /// </summary>
        /// <param name="CateName"></param>
        /// <param name="Name"></param>
        /// <param name="Tel"></param>
        /// <param name="Email"></param>
        /// <param name="Address"></param>
        /// <param name="QQInfo"></param>
        /// <param name="CheckCode"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public int CheckUserCount(string CateName = "", string Name = "", string Tel = "", string Email = "", string Address = "", string QQInfo = "", string CheckCode = "", bool IsDel = false)
        {
            int result = 0;
            result = UserBiz.CheckUserCount(CateName, Name, Tel, Email, Address, QQInfo, CheckCode, IsDel);
            return result;
        }


        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsOpen"></param>
        /// <returns></returns>
        public string CheckUser(int ID, bool IsOpen)
        {
            string result = "";
            result = UserBiz.CheckUser(ID, IsOpen);
            return result;
        }


        /// <summary>
        /// 根据Id获取申请人的详细信息
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public User CheckUserByID(int ID = 0)
        {
            User entity = new User();
            entity = UserBiz.CheckUserByID(ID);
            return entity;
        }
        
        /// <summary>
        /// 审核不通过，添加原因
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Remark"></param>
        /// <returns></returns>
        public int AddRemark(int ID ,string Remark)
        {
            int result = 0;
            result = UserBiz.AddRemark(ID, Remark);
            return result;
        }

        /// <summary>
        /// 创建审核
        /// </summary>
        /// <returns></returns>
        public MsgEntity CheckInsert(CheckUser U)
        {
            MsgEntity result = new MsgEntity();
            result = new UserBiz().CheckInsert(U);
            return result;
        }


        /// <summary>
        /// 后台添加经济商
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int BrokerSet(User entity)
        {
            int request = 0;
            request = new UserBiz().BrokerSet(entity);
            return request;
        }

        /// <summary>
        /// 后台审核经济商申请入驻
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="UserName"></param>
        /// <param name="Province"></param>
        /// <param name="City"></param>
        /// <param name="IsOpen"></param>
        /// <param name="CateID"></param>
        /// <param name="OrderID"></param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<OpenBourkerEntity> OpenBourkerList(int PageSize, int PageIndex, string UserName, string Province, string City, int IsOpen, int CateID, int OrderID, bool Desc, int IsDel)
        {
            List<OpenBourkerEntity> entitys = new List<OpenBourkerEntity>();
            entitys = new UserBiz().OpenBourkerList(PageSize, PageIndex, UserName, Province, City, IsOpen, CateID, OrderID, Desc, IsDel);

            return entitys;

        }


        /// <summary>
        /// 后台审核经济商申请入驻
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int OpenBourkerCount(string UserName, string Province, string City, int IsOpen, int CateID, int IsDel)
        {
            int request = 0;
            request = new UserBiz().OpenBourkerCount(UserName, Province, City, IsOpen, CateID, IsDel);
            return request;
        }

        /// <summary>
        /// 审核成功
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public int OpenBroKerSu(int UserID)
        {
            int request = 0;
            request = new UserBiz().OpenBroKerSu(UserID);
            return request;
        }
        #endregion

        #region 会员逻辑

        /// <summary>
        /// 普通会员
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="Email"></param>
        /// <param name="Mobile"></param>
        /// <param name="Name"></param>
        /// <param name="CateID"></param>
        /// <param name="Order"></param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<User> UserVip(int PageSize, int PageIndex, string Email, string Mobile, string Name, int CateID, int Order, bool Desc, bool IsDel)
        {
            List<User> entitys = new List<User>();
            entitys = new UserBiz().UserVip(PageSize, PageIndex, Email, Mobile, Name, CateID, Order, Desc, IsDel);

            return entitys;
        }
        /// <summary>
        /// 普通会员总数
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public int MUserCount(string Email, string Mobile, string Name, int CateID, bool IsDel)
        {
            int result = 0;
            result = UserBiz.MUserCount(Email, Mobile, Name, CateID, IsDel);
            return result;
        }

        /// <summary>
        /// 修改用户基本信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int UpdateUser(User entity)
        {
            int result = 0;
            result = UserBiz.UpdateUser(entity);
            return result;
        }

        /// <summary>
        /// 删除会员头像
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public int DelUserface(int ID)
        {
            int result = 0;
            result = UserBiz.DelUserface(ID);
            return result;
        }


        /// <summary>
        /// 创建会员
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity UserInsert(User U)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserInsert(U);
            return request;
        }

        /// <summary>
        /// 注册【用户名跟密码】
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity UserAdd(User U)
        {
            MsgEntity result = new MsgEntity();
            result = new UserBiz().UserAdd(U);
            return result;
        }


        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public int UpPassword(int UserID, string PassWord)
        {
            int request = 0;
            request = new UserBiz().UpPassword(UserID, PassWord);
            return request;
        }


        /// <summary>
        /// 获取会员信息
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public User UserByID(int ID)
        {
            User request = new User();
            request = new UserBiz().UserByID(ID);
            return request;
        }

        /// <summary>
        /// 详细的人员信息
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public UserInfo UserInfoByID(int ID = 0)
        {
            UserInfo request = new UserInfo();
            request = new UserBiz().UserInfoByID(ID);
            return request;
        }

        /// <summary>
        /// 获取会员信息
        /// </summary>
        /// <param name="Name"></param>
        /// <returns></returns>
        public User UserByName(string Name)
        {
            User request = new User();
            request = new UserBiz().UserByName(Name);
            return request;
        }

        /// <summary>
        /// 登陆
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Pass"></param>
        /// <param name="IP"></param>
        /// <returns></returns>
        public User UserLogin(string Name, string Pass, string IP)
        {
            User request = new User();
            request = new UserBiz().UserLogin(Name, Pass, IP);
            return request;
        }


        /// <summary>
        /// 存在
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Type"></param>
        /// <returns></returns>
        public int HasUser(string Name, int Type)
        {
            int request = new UserBiz().HasUser(Name, Type);
            return request;
        }

        /// <summary>
        /// 会员动作  Filed == "IsDel"  || Filed == "EmailAudit"  || Filed == "MobileAudit" || Filed == "IsOpen" 
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Filed"></param>
        /// <param name="Fn"></param>
        /// <returns></returns>
        public MsgEntity UserAction(int ID, string Filed, bool Fn)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserAction(ID, Filed, Fn);
            return request;
        }

        /// <summary>
        /// 更新会员-动作中有的这里不允许更新
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity UserSet(UserInfo U)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserSet(U);
            return request;
        }




        /// <summary>
        /// 注册会员时-经济商填写信息
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity UserBrokerSet(UserBrokerEntity U)
        {

            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserBrokerSet(U);
            return request;
        }

        /// <summary>
        /// 查看申请经济商和分析师账号的详细信息
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public UserBrokerEntity MGetCheckUser(int ID)
        {
            UserBrokerEntity request = new UserBrokerEntity();
            request = new UserBiz().MGetCheckUser(ID);
            return request;
        }


           /// <summary>
        /// 新建经济商-动作中有的这里不允许更新
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public int UserApplyBroker(UserInfo U)
        {
            int request = new UserBiz().UserApplyBroker(U);
            return request;
        }

        /// <summary>
        /// 更新会员单个资料 更新：@Sex，@CardNO，@Introduce，@Tel，@Address，@Portrait
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity UserSetOne(int ID, string Filed, string Value)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserSetOne(ID, Filed, Value);
            return request;
        }

        /// <summary>
        /// 会员绑定  Filed == "Email"  || Filed == "Mobile" 
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Filed"></param>
        /// <param name="Val"></param>
        /// <returns></returns>
        public MsgEntity UserBind(string Filed, string Val)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserBind(Filed, Val);
            return request;
        }




        /// <summary>
        /// 已经绑定过得手机或者邮箱，再绑定邮箱或手机
        /// </summary>
        /// <param name="Filed"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        public MsgEntity UserTwoBind(string Filed, string Val, int ID)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserTwoBind(Filed, Val, ID);
            return request;
        }

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Word"></param>
        /// <returns></returns>
        public MsgEntity UserPassWord(string Name, string Code, string Pass)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UserPassWord(Name, Code, Pass);
            return request;
        }


        /// <summary>
        /// 微信登录
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity WeiXinLogin(string OpenID, string Province, string City, string Sex, string Name, string Portrait, string ip)
        {

            MsgEntity request = new MsgEntity();
            request = new UserBiz().WeiXinLogin(OpenID, Province, City, Sex, Name, Portrait, ip);
            return request;
        }

        /// <summary>
        /// QQ登录
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Word"></param>
        /// <returns></returns>
        public MsgEntity QQLogin(string OpenID, string Province, string City, string Sex, string Name, string Portrait, string ip)
        {

            MsgEntity request = new MsgEntity();
            request = new UserBiz().QQLogin(OpenID, Province, City, Sex, Name, Portrait, ip);
            return request;
        }

        /// <summary>
        /// 微博登录
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Word"></param>
        /// <returns></returns>
        public MsgEntity WeiboLogin(string OpenID, string Province, string City, string Sex, string Name, string Portrait, string ip)
        {

            MsgEntity request = new MsgEntity();
            request = new UserBiz().WeiboLogin(OpenID, Province, City, Sex, Name, Portrait, ip);
            return request;
        }


        /// <summary>
        /// 后團管理人員主動幫用戶改類型
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="CateID"></param>
        /// <returns></returns>
        public int ManageCheckUser(int ID, int CateID)
        {
            int result = 0;
            result = UserBiz.ManageCheckUser(ID, CateID);
            return result;
        }


        /// <summary>
        /// 绑定处理
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Code"></param>
        /// /// <param name="Type"></param>
        /// <returns></returns>
        public MsgEntity BoundUser(int UserID,string Name, string Code, bool Type) {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().BoundUser(UserID,Name, Code, Type);
            return request;
        }

        /// <summary>
        /// 搜索所有的用户
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="Email"></param>
        /// <param name="Mobile"></param>
        /// <param name="Name"></param>
        /// <param name="UserID"></param>
        /// <param name="Order"></param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<UserFocusEntity> UserOrder(int PageSize, int PageIndex, string Email, string Mobile, string Name, int UserID, int Order, bool Desc, bool IsDel)
        {
            List<UserFocusEntity> request = new List<UserFocusEntity>();
            request = new UserBiz().UserOrder(PageSize, PageIndex, Email, Mobile, Name, UserID, Order, Desc, IsDel);
            return request;
        }


        /// <summary>
        /// 判断qq是否被注册过
        /// </summary>
        /// <param name="OpenID"></param>
        /// <returns></returns>
        public User UserByQQID(string OpenID)
        {
            User entity = new User();
            entity = new UserBiz().UserByQQID(OpenID);
            return entity;
        }
        #endregion

        #region 公司逻辑
        /// <summary>
        /// 创建公司
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity CompanyInsert(CompanyEntity U)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().CompanyInsert(U);
            return request;
        }

        /// <summary>
        /// 公司动作 Filed == "IsDel"  || Filed == "Audit"
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Filed"></param>
        /// <param name="Fn"></param>
        /// <returns></returns>
        public MsgEntity CompanyAction(int ID, string Filed, bool Fn)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().CompanyAction(ID, Filed, Fn);
            return request;
        }

        /// <summary>
        /// 更新公司
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity CompanySet(CompanyEntity U)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().CompanySet(U);
            return request;
        }

        /// <summary>
        /// 获取公司信息
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public CompanyEntity CompanyByID(int UserID)
        {
            CompanyEntity request = new CompanyEntity();
            request = new UserBiz().CompanyByID(UserID);
            return request;
        }


        /// <summary>
        /// 获取公司排序信息
        /// </summary>
        /// <param name="Filed"></param>
        /// <param name="Page"></param>
        /// <param name="PageSize"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<CompanyEntity> CompanySort(string Filed, int Page, int PageSize, bool Desc, string Compel)
        {
            List<CompanyEntity> request = new List<CompanyEntity>();
            request = new UserBiz().CompanySort(Filed, Page, PageSize, Desc, Compel);
            return request;
        }

        #endregion

        #region 关注/粉丝
        /// <summary>
        /// 创建关注
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity FocusSet(int UserID, int FocusID, bool IsDel)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().FocusSet(UserID, FocusID, IsDel);
            return request;
        }

        /// <summary>
        /// 关注粉丝列表
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="IsMe"></param>
        /// <returns></returns>
        public List<UserFocusEntity> FocusList(int UserID, bool IsMe)
        {
            List<UserFocusEntity> request = new List<UserFocusEntity>();
            request = new UserBiz().FocusList(UserID, IsMe);
            return request;
        }


        /// <summary>
        /// 我关注的人，关注我的人
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<UserFocusTEntity> FocusFans(int UserID)
        {
            List<UserFocusTEntity> request = new List<UserFocusTEntity>();
            request = new UserBiz().FocusFans(UserID);
            return request;
        }

        /// <summary>
        /// 已经关注
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="FocusID"></param>
        /// <returns></returns>
        public bool FocusHas(int UserID, int FocusID)
        {
            bool request = false;
            request = new UserBiz().FocusHas(UserID, FocusID);
            return request;
        }


        /// <summary>
        /// 热门吧主
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="UserID"></param>
        /// <param name="Sort">默认根据粉丝数排行，1-时间</param>
        /// <param name="Desc"></param>
        /// <returns></returns>
        public List<UserFocusEntity> FocusSort(int PageSize, int PageIndex, int UserID, int Sort, bool Desc)
        {
            List<UserFocusEntity> request = new List<UserFocusEntity>();
            request = new UserBiz().FocusSort(PageSize, PageIndex, UserID, Sort, Desc);
            return request;
        }

        #endregion

        #region 私信
        /// <summary>
        /// 创建私信
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity LetterInsert(int FromID, int ToID, string Text)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().LetterInsert(FromID, ToID, Text);
            return request;
        }

        /// <summary>
        /// 获取私信
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public ULetter LetterByID(int ID, int UserID)
        {
            ULetter request = new ULetter();
            request = new UserBiz().LetterByID(ID, UserID);
            return request;
        }

        /// <summary>
        /// 删除私信
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public bool LetterDelete(int ID, int UserID)
        {
            bool request = false;
            request = new UserBiz().LetterDelete(ID, UserID);
            return request;
        }

        /// <summary>
        /// 私信列表
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="IsFrom"></param>
        /// <returns></returns>
        public List<ULetter> Letter(int UserID, int Page, int PageSize, bool IsFrom)
        {
            List<ULetter> request = new List<ULetter>();
            request = new UserBiz().Letter(UserID, Page, PageSize, IsFrom);
            return request;
        }


        /// <summary>
        /// 手机查询私信列表
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<ULetter> PLetter(int UserID, string OpenTime, string EndTime, int PageSize, bool IsFrom)
        {
            List<ULetter> request = new List<ULetter>();
            request = new UserBiz().PLetter(UserID, OpenTime, EndTime, PageSize, IsFrom);
            return request;
        }


        /// <summary>
        /// 阅读私信
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public MsgEntity LetterSet(int ID, int UserID)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().LetterSet(ID, UserID);
            return request;
        }
        #endregion

        #region 自选
        /// <summary>
        /// 创建自选
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="UserID"></param>
        /// <param name="Code"></param>
        /// <returns></returns>
        public MsgEntity ChooseInsert(int UserID, int CenterID, string Code)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().ChooseInsert(UserID, CenterID, Code);
            return request;
        }

        /// <summary>
        /// 是否已经自选
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="UserID"></param>
        /// <param name="Code"></param>
        /// <returns></returns>
        public bool ChooseHas(int UserID, int CenterID, string Code)
        {
            bool request = false;
            request = new UserBiz().ChooseHas(UserID, CenterID, Code);
            return request;
        }

        /// <summary>
        /// 删除自选
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="UserID"></param>
        /// <param name="Code"></param>
        /// <returns></returns>
        public bool ChooseDelete(int UserID, int CenterID, string Code)
        {
            bool request = false;
            request = new UserBiz().ChooseDelete(UserID, CenterID, Code);
            return request;
        }

        /// <summary>
        /// 自选列表
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<UserCodeEntity> Choose(int UserID)
        {
            List<UserCodeEntity> request = new List<UserCodeEntity>();
            request = new UserBiz().Choose(UserID);
            return request;
        }

        /// <summary>
        /// 自选排行
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<Goods> ChooseSort(int Size)
        {
            List<Goods> request = new List<Goods>();
            request = new UserBiz().ChooseSort(Size);
            return request;
        }
        #endregion

        #region 开户列表

        /// <summary>
        /// 开户列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="UserName"></param>
        /// <param name="CenterID"></param>
        /// <param name="Sort"></param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<UOpen> OpenList(int PageSize, int PageIndex, string UserName, int CenterID, string Code, int Sort, bool Desc, bool IsDel)
        {
            List<UOpen> request = new List<UOpen>();
            request = new UserBiz().OpenList(PageSize, PageIndex, UserName, CenterID, Code, Sort, Desc, IsDel);
            return request;
        }


        /// <summary>
        /// 开户总数
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public int MOpenCount(string UserName, int CenterID, string Code, bool IsDel)
        {
            int result = 0;
            result = UserBiz.MOpenCount(UserName, CenterID, Code, IsDel);
            return result;
        }

        /// <summary>
        /// 开户列表
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<UOpen> Open(int UserID, bool IsDel)
        {
            List<UOpen> request = new List<UOpen>();
            request = new UserBiz().Open(UserID, IsDel);
            return request;
        }



        /// <summary>
        /// 设置开户
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity OpenSet(UOpen U)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().OpenSet(U);
            return request;
        }

        /// <summary>
        /// 删除开户信息
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public int DelOpen(int ID)
        {
            int result = 0;
            result = new UserBiz().DelOpen(ID);
            return result;

        }
        #endregion

        #region 模拟交易

        /// <summary>
        /// 新增交易
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="CenterID"></param>
        /// <param name="Code"></param>
        /// <param name="Amount"></param>
        /// <param name="CurPrice"></param>
        /// <returns></returns>
        public MsgEntity TradInsert(int UserID, int CenterID, string CenterName, string Code, string Name, int Amount, decimal CurPrice, decimal Poundage)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().TradInsert(UserID, CenterID, CenterName, Code, Name, Amount, CurPrice, Poundage);
            return request;
        }


        /// <summary>
        /// 可交易藏品
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<TardEntity> TradUsable(int UserID)
        {
            List<TardEntity> request = new List<TardEntity>();
            request = new UserBiz().TradUsable(UserID);
            return request;
        }


        /// <summary>
        /// 交易列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="Page"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<TardEntity> TradList(int Page, int PageSize, int UserID)
        {
            List<TardEntity> request = new List<TardEntity>();
            request = new UserBiz().TradList(Page, PageSize, UserID);
            return request;
        }
        /// <summary>
        /// 手机查询交易列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="Page"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<TardEntity> PTradList(string OpenTime, string EndTime, int PageSize, int UserID)
        {
            List<TardEntity> request = new List<TardEntity>();
            if (UserID == 0)
            {
                return request;
            }
            request = new UserBiz().PTradList(OpenTime, EndTime, PageSize, UserID);
            return request;
        }

        #endregion

        #region 会员点击排行，会员积分排行
        /// <summary>
        /// 会员点击排行 Filed= Hits || Score
        /// </summary>
        /// <param name="Filed"></param>
        /// <returns></returns>
        public List<User> UserSort(string Filed, int Size)
        {
            List<User> request = new List<User>();
            request = new UserBiz().UserSort(Filed, Size);
            return request;
        }

        /// <summary>
        /// 机构排行
        /// </summary>
        /// <param name="Filed"></param>
        /// <returns></returns>
        public List<User> OrgSort(string Filed, int Page, int PageSize, string Province, string City)
        {
            List<User> request = new List<User>();
            request = new UserBiz().OrgSort(Filed, Page, PageSize, Province, City);
            return request;
        }

        /// <summary>
        /// 机构排行
        /// </summary>
        /// <param name="Filed"></param>
        /// <param name="CompanyName">可根据公司名模糊查询</param>
        /// <returns></returns>
        public List<User> OrgSortByCompany(string Filed, int Page, int PageSize, string Province, string City, string CompanyName)
        {
            List<User> request = new List<User>();
            request = new UserBiz().OrgSortByCompany(Filed, Page, PageSize, Province, City, CompanyName);
            return request;
        }

        /// <summary>
        /// 机构排行
        /// </summary>
        /// <param name="Filed"></param>
        /// <returns></returns>
        public List<User> POrgSort(string Filed, string OpenTime, string EndTime, int PageSize, string Province, string City)
        {
            List<User> request = new List<User>();
            request = new UserBiz().POrgSort(Filed, OpenTime, EndTime, PageSize, Province, City);
            return request;
        }

        /// <summary>
        /// 机构排行
        /// </summary>
        /// <param name="Filed"></param>
        /// <returns></returns>
        public List<User> OrgSaerch(string Filed, int Page, int PageSize, int CenterID)
        {
            List<User> request = new List<User>();
            request = new UserBiz().OrgSaerch(Filed, Page, PageSize, CenterID);
            return request;
        }

        /// <summary>
        /// 机构排行
        /// </summary>
        /// <param name="Filed"></param>
        /// <returns></returns>
        public List<User> POrgSaerch(string Filed, string OpenTime, string EndTime, int PageSize, int CenterID)
        {
            List<User> request = new List<User>();
            request = new UserBiz().POrgSaerch(Filed, OpenTime, EndTime, PageSize, CenterID);
            return request;
        }
        #endregion

        #region 收藏
        /// <summary>
        /// 收藏列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="Page"></param>
        /// <param name="Order">根据时间排序</param>
        /// <param name="UserID"></param>
        /// <param name="BarID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<Bar> CollBarList(int PageSize, int Page, int Order, int UserID, int BarID, bool IsDel)
        {
            List<Bar> request = new List<Bar>();
            request = UserBiz.CollBarList(PageSize, Page, Order, UserID, BarID, IsDel);
            return request;
        }
        /// <summary>
        /// 手机查询收藏列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="Page"></param>
        /// <param name="Order">根据时间排序</param>
        /// <param name="UserID"></param>
        /// <param name="BarID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<Bar> PCollBarList(string OpenTime, string EndTime, int PageSize, int Order, int UserID, int BarID, bool IsDel)
        {
            List<Bar> result = new List<Bar>();
            result = UserBiz.PCollBarList(OpenTime, EndTime, PageSize, Order, UserID, BarID, IsDel);
            return result;
        }

        /// <summary>
        /// 收藏邮吧
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int CollectBar(CollectBar entity)
        {
            int result = 0;
            result = UserBiz.CollectBar(entity);
            return result;
        }

        /// <summary>
        /// 取消收藏
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public int UnCollect(int barID, int UserId)
        {
            int result = 0;
            result = UserBiz.UnCollect(barID, UserId);
            return result;
        }
        #endregion

        #region 点赞
        /// <summary>
        /// 点赞
        /// </summary>
        /// <param name="usreid"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public int clickCon(int usreid, int id)
        {
            int result = 0;
            result = UserBiz.clickCon(usreid, id);
            return result;
        }


        /// <summary>
        /// 取消点赞
        /// </summary>
        /// <param name="usreid"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public int clickNoCon(int usreid, int id)
        {
            int result = 0;
            result = UserBiz.clickNoCon(usreid, id);
            return result;
        }
        #endregion

        #region 活动
        /// <summary>
        /// 设置开户
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity ActivitySet(Activity U)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().ActivitySet(U);
            return request;
        }

        /// <summary>
        /// 活动
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public Activity ActivityByID(int ID)
        {
            Activity request = new Activity();
            request = new UserBiz().ActivityByID(ID);
            return request;
        }

        /// <summary>
        /// 活动列表
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public List<Activity> Activity(int UserID, int Page, int PageSize)
        {
            List<Activity> request = new List<Activity>();
            request = new UserBiz().Activity(UserID, Page, PageSize);
            return request;
        }


        /// <summary>
        /// 可根据交易所查询活动列表
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public List<Activity> ActivityByCenter(int UserID, int Page, int PageSize, int CenterID, int Order, bool Desc)
        {
            List<Activity> request = new List<Activity>();
            request = new UserBiz().ActivityByCenter(UserID, Page, PageSize, CenterID, Order, Desc);
            return request;
        }

        /// <summary>
        /// 手机查询活动列表
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public List<Activity> PActivity(int UserID, string OpenTime, string EndTime, int PageSize)
        {
            List<Activity> request = new List<Activity>();
            request = new UserBiz().PActivity(UserID, OpenTime, EndTime, PageSize);
            return request;
        }


        /// <summary>
        /// 后台查询活动列表
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public List<Activity> MActivity(int UserID, int Page, int PageSize, int Order, bool Desc)
        {
            List<Activity> request = new List<Activity>();
            request = new UserBiz().MActivity(UserID, Page, PageSize, Order, Desc);
            return request;
        }

        /// <summary>
        /// 活动总数
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public int ActivityCount(int UserID)
        {
            int result = 0;
            result = UserBiz.ActivityCount(UserID);
            return result;
        }


        /// <summary>
        /// 后台删除活动
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public int DelActivity(int ID)
        {
            int result = 0;
            result = new UserBiz().DelActivity(ID);
            return result;
        }

        /// <summary>
        /// 活动删除
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        public MsgEntity ActivityDel(int ID, int UserID)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().ActivityDel(ID, UserID);
            return request;
        }


        /// <summary>
        /// 活动过期
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="UserID"></param>
        /// <param name="OutDate"></param>
        /// <returns></returns>
        public MsgEntity ActivityOutDate(int ID, int UserID, bool OutDate)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().ActivityOutDate(ID, UserID, OutDate);
            return request;
        }



        /// <summary>
        /// 活动交易所
        /// </summary>
        /// <returns></returns>
        public List<NewsBourseGroupEntity> BourseGroup()
        {
            List<NewsBourseGroupEntity> request = new List<NewsBourseGroupEntity>();
            request = new UserBiz().BourseGroup();
            return request;
        }
        #endregion

        #region 分析师

        /// <summary>
        /// 申请绑定
        /// </summary>
        /// <returns></returns>
        public MsgEntity Underling(int UID, int UserID)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().Underling(UID, UserID);
            return request;
        }
        /// <summary>
        /// 状态
        /// </summary>
        /// <returns></returns>
        public MsgEntity UnderlingState(int UID, int UserID)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UnderlingState(UID, UserID);
            return request;
        }

        /// <summary>
        /// 状态
        /// </summary>
        /// <returns></returns>
        public List<User> UnderlingList(int UID)
        {
            List<User> request = new List<User>();
            request = new UserBiz().UnderlingList(UID);
            return request;
        }
        /// <summary>
        /// 更新状态
        /// </summary>
        /// <returns></returns>
        public MsgEntity UnderlingSet(int ID, int UserID, bool Fn)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UnderlingSet(ID, UserID, Fn);
            return request;
        }


        /// <summary>
        /// 分析师列表
        /// </summary>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="Where">邮箱或者手机号</param>
        /// <param name="Order"></param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<AnalystEntity> AnalystList(int PageIndex, int PageSize, string Where, int UserID, int Order, bool Desc, bool IsDel)
        {
            List<AnalystEntity> request = new List<AnalystEntity>();
            request = new UserBiz().AnalystList(PageIndex, PageSize, Where, UserID, Order, Desc, IsDel);
            return request;
        }
        /// <summary>
        /// 经济商邀请分析师
        /// </summary>
        /// <returns></returns>
        public MsgEntity UnderlingAdd(int UID, int UserID, int Fn)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UnderlingAdd(UID, UserID,Fn);
            return request;
        }


        /// <summary>
        /// 通过申请
        /// </summary>
        /// <param name="UID">分析师</param>
        /// <param name="UserID">经济商</param>
        /// <param name="Fn"></param>
        /// <returns></returns>
        public MsgEntity UnderlingPass(int ID, int UID, int UserID, int Fn)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UnderlingPass(ID, UID, UserID, Fn);
            return request;
        }

        
        /// <summary>
        /// 分析师被谁邀请
        /// </summary>
        /// <param name="Filed"></param>
        /// <returns></returns>
        public List<User> UnderlingAnalyst(int UID)
        {
            List<User> request = new List<User>();
            request = new UserBiz().UnderlingAnalyst(UID);
            return request;
        }
        #endregion


        #region 后台
        public MUser MUserLogin(string UserName, string PassWord)
        {
            MUser request = new MUser();
            request = UserBiz.MUserLogin(UserName, PassWord);
            return request;
        }


        /// <summary>
        /// 添加日志
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="Detail"></param>
        /// <returns></returns>
        public int MLogAdd(int UserID, string Name, string Detail, string Remarl)
        {
            int request = 0;
            request = UserBiz.MLogAdd(UserID, Name, Detail, Remarl);
            return request;
        }

        /// <summary>
        ///修改后台密码
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="Pwd"></param>
        /// <param name="NewPwd"></param>
        /// <returns></returns>
        public int MUpdatePwd(int UserID, string Pwd, string NPwd)
        {
            int request = 0;
            request = UserBiz.MUpdatePwd(UserID, Pwd, NPwd);
            return request;
        }
        #endregion


        #region 委托
        /// <summary>
        /// 委托
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<UserEntrustEntity> UEntrustList(int UserID)
        {
            List<UserEntrustEntity> request = new List<UserEntrustEntity>();
            request = new UserBiz().UEntrustList(UserID);
            return request;
        }


        /// <summary>
        /// 委托
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<UStock> UStockList(int UserID)
        {
            List<UStock> request = new List<UStock>();
            request = new UserBiz().UStockList(UserID);
            return request;
        }


        /// <summary>
        /// 委托[买]
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public MsgEntity UEntrustBuy(UserEntrustEntity entity)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UEntrustBuy(entity);

            return request;
        }


        /// <summary>
        /// 委托-[卖出]
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public MsgEntity UEntrustSell(UserEntrustEntity entity)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UEntrustSell(entity);

            return request;
        }

        /// <summary>
        /// 委托是否完成
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsFinish">true-买,false-卖</param>
        /// <returns></returns>
        public MsgEntity UEntrusStock(int ID, int UserID, bool IsFinish, DateTime CreateTime)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UEntrusStock(ID, UserID, IsFinish,CreateTime);
            return request;
        }

        /// <summary>
        /// 委托完成
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsFinish">true-买,false-卖</param>
        /// <returns></returns>
        public MsgEntity UEntrusStockSuc(int ID, decimal LastPrice, DateTime CreateTime)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UEntrusStockSuc(ID, LastPrice,CreateTime);
            return request;
        }       
        
        /// <summary>
        /// 删除委托
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public MsgEntity UEntrustDel(int ID)
        {
            MsgEntity request = new MsgEntity();
            request = new UserBiz().UEntrustDel(ID);
            return request;
        }

        /// <summary>
        /// 清空委托表
        /// </summary>
        /// <returns></returns>
        public int UEntrusClear()
        {
            int result = 0;
            result = new UserBiz().UEntrusClear();
            return result;

        }
        #endregion
    }
}
